<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>控制台 | 后台管理系统</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" href="/static/admin/bower_components/bootstrap/dist/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="/static/admin/bower_components/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="/static/admin/bower_components/Ionicons/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/static/admin/dist/css/AdminLTE.min.css">
    <!-- iCheck for checkboxes and radio inputs -->
    <link rel="stylesheet" href="/static/admin/plugins/iCheck/all.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="/static/admin/dist/css/skins/_all-skins.min.css">

    <link rel="stylesheet" href="/static/admin/dist/css/admin.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Google Font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
    {block name="css"}{/block}

</head>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">

    {include file="common/header" /}

    <!-- =============================================== -->

    <!-- Left side column. contains the sidebar -->
    {include file="common/aside" /}

    <!-- =============================================== -->

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">

            {block name="breadcrumb"}
            <h1>
                空白页面
                <small>所有都从开始</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">示例</a></li>
                <li class="active">空白页面</li>
            </ol>
            {/block}

        </section>

        {block name="search"}{/block}

        <!-- Main content -->
        <section class="content">

            {block name="content"}
            <!-- Default box -->
            
            <!-- /.box -->
            {/block}
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    {include file="common/footer" /}


    <!-- Control Sidebar -->
    {include file="common/right_aside" /}
    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<!-- jQuery 3 -->
<script src="/static/admin/bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="/static/admin/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="/static/admin/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="/static/admin/bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="/static/admin/dist/js/adminlte.min.js"></script>
<!-- admin -->
<script src="/static/admin/dist/js/admin.js"></script>
<!-- Layer -->
<script src="/static/admin/plugins/layer/layer.js"></script>
<!-- notify -->
<script src="/static/admin/plugins/bootstrap-notify/bootstrap-notify.min.js"></script>
<!-- iCheck -->
<script src="/static/admin/plugins/iCheck/icheck.min.js"></script>
<!-- Validate -->
<script src="/static/admin/plugins/validation/jquery.validate.min.js"></script>

<script>
    //注销登陆
    $('.logout-btn').click(function(){
        layer.confirm('是否确定要注销登陆？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            layer.msg('推出登陆成功', {icon: 1});
            var t = setInterval(function () {
                location.href = "{:Url('Publics/logout')}"
            },500)
        }, function(){

        });
    });
    // init validate
    $.validator.setDefaults({

        submitHandler: function(form) {
            // form.submit();
            var url = $(form).attr('action');
            $.ajax({
                url: url,
                type : "POST",
                data: $(form).serialize(),
                success: function(result){
                    console.log(result);
                    if (result.code === 1){
                        $.notify({
                            message: result.msg,
                            icon: 'glyphicon glyphicon-ok'
                        }, {
                            allow_dismiss: true,
                            type: 'success'
                        });
                        var tOut = setTimeout(function(){
                            clearTimeout(tOut);
                            window.location.href = result.url;
                        },1000);
                    }else{
                        $.notify({
                            message: result.msg,
                            icon: 'glyphicon glyphicon-warning-sign'
                        }, {
                            allow_dismiss: true,
                            type: 'warning'
                        });
                        // layer.msg(result.msg)
                    }
                }

            });
        },
        errorPlacement: function(error, element) {
            // $('.validate-err').html( error );
            // $(element).parent().parent().addClass('has-error');
            //$( element ).parent().find('.help-block').append(error);
            $(element).parent().append(error);
//            $( element )
//                .closest( "form" )
//                .find( "label[for='" + element.attr( "id" ) + "']" )
//                .append( error );
//            $( element )
//                .closest( "form" )
//                .find("span.help-block." + element.attr( "id" ))
//                .append( error );
        }
    });
    // 手机号码验证
    $.validator.addMethod("isMobile", function(value, element) {
        var length = value.length;
        var mobile = /^(10[0-9]{9})|(19[0-9]{9})|(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
        return this.optional(element) || (length == 11 && mobile.test(value));
    }, "请正确填写您的手机号码");

</script>
{block name="js"}{/block}
</body>
</html>
